<?php


namespace app\test\controller;


use app\common\lib\MentalTestUtil;
use app\common\lib\Util;
use think\Controller;


class TestMentalTest extends Controller
{


    private function test()
    {
//        $signature = MentalTestUtil::generateSignature(['channelId' => config('mental_test.channel_id'), 1]);
        $signature = MentalTestUtil::generateSignature([1]);
        $url = config('mental_test.url') . '/lingxi/service/getScales?channelId=' . config('mental_test.channel_id') . '&page=1&signature=' . $signature;
        $result = Util::curlRequest('GET', $url);
        return show(config('code.success'), '请求成功', $result);
    }

    private function pay()
    {
        MentalTestUtil::pay(123, '123', 349, 17);
    }

    private function order()
    {
        $data = MentalTestUtil::queryOrder('002021042516433844');
        return $data;
    }

    private function questions()
    {
        return MentalTestUtil::getUserQuestions(12345883, 1);
    }

    public function decode()
    {
        $url = 'https://cpapi-box4.xinli001.com/cp/service/login?channelId\u003d3275\u0026username\u003d96if-jqpu-inqf';
        $str = '\u0026';
        $str1 = '\u003d';
        $url = str_replace(array($str, $str1), array('&', '='), $url);
        return show(config('code.success'), '请求成功', $url);
    }
}
